package com.dsz.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dsz.entity.Users;
import com.dsz.service.UsersService;
import com.dsz.until.FenyeUtil;
@CrossOrigin
@RestController
public class UsersController {

	@Autowired
	private UsersService us;
	@RequestMapping("/all")
	public List<Users> all(){
		return us.all();
	}
	
	//分页+查询所有
	@RequestMapping("/getAll")
	public FenyeUtil<Users> getAll(FenyeUtil<Users> fy, Users users){
		fy = us.getAll(fy,users);
		return fy;
	}
	
	
	//删除  单删
	@RequestMapping("/getDelete")
	public Integer getDelete(String uid) {
		return us.getDelete(uid);
	}
	
	//批量删除
	@RequestMapping("/delStudent")
	public Integer delStudent(@RequestParam("uid")List<String> uid) {
		return us.delStudent(uid);
	}
	
	//添加用户
	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public Map<String, Object> add(Users user) {
		return us.add(user);
	}
	
	/**
	 * 修改是否锁定
	 * @param uid
	 * @param islockout
	 * @return
	 */
	@RequestMapping(value = "/editIslockout", method = RequestMethod.POST)
	public Integer editIslockout(String uid, String lslockout) {
		return us.editIslockout(uid, lslockout);
	}
	
}
